package cn.levill.domain.activity.service.quota;

import cn.levill.domain.activity.model.entity.ActivityCountEntity;
import cn.levill.domain.activity.model.entity.ActivityEntity;
import cn.levill.domain.activity.model.entity.ActivitySkuEntity;
import cn.levill.domain.activity.repository.IActivityRepository;
import cn.levill.domain.activity.service.quota.rule.factory.DefaultActivityChainFactory;

/**
 * @author Levill
 * @description 抽奖活动的支撑类
 * @date 2025/02/20 00:29
 */
public class RaffleActivityAccountQuotaSupport {
    protected IActivityRepository activityRepository;
    protected DefaultActivityChainFactory defaultActivityChainFactory;

    public RaffleActivityAccountQuotaSupport(IActivityRepository activityRepository, DefaultActivityChainFactory defaultActivityChainFactory) {
        this.activityRepository = activityRepository;
        this.defaultActivityChainFactory = defaultActivityChainFactory;
    }

    /**
     * 通过sku查询活动信息
     *
     * @param sku SKU
     * @return {@link ActivitySkuEntity }
     */
    public ActivitySkuEntity queryActivitySku(Long sku) {
        return activityRepository.queryActivitySku(sku);
    }

    /**
     * 根据活动ID查询抽奖活动
     *
     * @param activityId 活动 ID
     * @return {@link ActivityEntity } 抽奖活动实体
     */
    public ActivityEntity queryRaffleActivityByActivityId(Long activityId) {
        return activityRepository.queryRaffleActivityByActivityId(activityId);
    }

    /**
     * 根据活动ID查询抽奖活动信息（用户在活动上可参与的次数）
     *
     * @param activityCountId 活动计数 ID
     * @return {@link ActivityCountEntity } 活动次数实体
     */
    public ActivityCountEntity queryRaffleActivityCountByActivityId(Long activityCountId) {
        return activityRepository.queryRaffleActivityCountByActivityId(activityCountId);
    }

}
